package com.linked.store.thing.bean.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.linked.store.thing.bean.param.AddThingParam;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * @author :dbq
 * @date : 2023/3/17 10:34
 * @description : desc
 */
@Data
@TableName("store_thing_info")
public class ThingInfoPO {
    @TableId(value = "thing_id", type = IdType.ASSIGN_UUID)
    private String thingId;
    @TableField("thing_name")
    private String thingName;
    @TableField("buy_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime buyTime;
    @TableField("brand_id")
    private String brandId;
    @TableField("sellby_date")
    private String sellByDate;
    @TableField("if_favous")
    private Integer ifFavous;

    @TableField("thing_type")
    private Integer thingType;

    @TableField("thing_count")
    private Integer thingCount;

    @TableField("create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @TableField("data_status")
    private Integer dataStatus;

    @TableField("remarks")
    private String remarks;

    public ThingInfoPO(AddThingParam param) {
        this.thingName = param.getThingName();
        this.buyTime = param.getBuyTime();
        this.brandId = param.getBrandId();
        this.sellByDate = param.getSellByDate();
        this.ifFavous = param.getIfFavous();
        this.thingType = param.getThingType();
        this.thingCount = param.getThingCount();
        this.remarks = param.getRemarks();
    }

    public ThingInfoPO() {
    }
}
